//
//  TranslationFilterModel.swift
//  GLUZSwift
//
//  Created by xyanl on 2025/3/14.
//  Copyright © 2025 考拉🐨. All rights reserved.
//

import UIKit
import Foundation

class TranslationFilterUIModel: BaseModel, NSCopying {
   
    var id: Int = 0
    var title: String = ""
    var titleRu: String = ""
    var subTitle: String = ""
    var subTitleRu: String = ""
    var list: [TranslationFilterModel] = []
    
    init(id: Int, title: String, titleRu: String, list: [TranslationFilterModel]) {
        self.id = id
        self.title = title
        self.titleRu = titleRu
        self.list = list
    }
    
    required init() {
        
    }
    
    func copy(with zone: NSZone? = nil) -> Any {
//        let theCopyObj = type(of: self).init()
//        theCopyObj.id = self.id
//        theCopyObj.title = self.title
//        theCopyObj.list = self.list
//        return theCopyObj
        return TranslationFilterUIModel(id: self.id, title: self.title, titleRu: self.titleRu, list: self.list)
    }
    
    
    static func dataSources() -> [TranslationFilterUIModel] {
        let arr = [
            [
                "id": 0,
                "title": "语言选择",
                "titleRu": "Выбор языка",
                "subTitle": "(多选)",
                "subTitleRu": "（выбрать несколько）",
                "list": [
                    [
                        "id": 0,
                        "name": "中文",
                        "nameRu": "Китайский"
                    ],
                    [
                        "id": 1,
                        "name": "俄文",
                        "nameRu": "Русский"
                    ]
                ]
            ],
            [
                "id": 2,
                "title": "专业方向",
                "titleRu": "Выбор региона",
                "list": []
            ],
            [
                "id": 3,
                "title": "价格选择",
                "titleRu": "Выберите цену",
                "subTitle": "（积分/分钟）",
                "subTitleRu": "（б./мин）",
                "list": []
            ],
            [
                "id": 4,
                "title": "国籍选择",
                "titleRu": "Выберите гражданство",
                "list": [
                    [
                        "id": 0,
                        "name": "中国",
                        "nameRu": "Китай"
                    ],
                    [
                        "id": 1,
                        "name": "俄罗斯",
                        "nameRu": "Россия"
                    ]
                ]
            ],
            [
                "id": 1,
                "title": "地区选择",
                "titleRu": "Выбор региона",
                "subTitle": "",
                "subTitleRu": "",
                "list": [
                    [
                        "id": 0,
                        "name": "地区选择",
                        "nameRu": "Выбор региона"
                    ]
                ]
            ],
        ]
        return JsonUtil.modelsFromArray(arr, TranslationFilterUIModel.self)
    }
}

class TranslationFilterModel: BaseModel, NSCopying {
    
    var id: Int = 0
    var name: String = ""
    var nameRu: String = ""
    
    init(id: Int, name: String, nameRu: String, isSelected: Bool) {
        self.id = id
        self.name = name
        self.nameRu = nameRu
        super.init()
        self.isSelected = isSelected
    }
    
    required init() {
        
    }
    
    func copy(with zone: NSZone? = nil) -> Any {
        return TranslationFilterModel(id: self.id, name: self.name, nameRu: self.nameRu, isSelected: self.isSelected)

    }
    
}
